package com.feri.fss.service.impl;

import com.feri.fss.common.vo.PageBean;
import com.feri.fss.dao.UserDao;
import com.feri.fss.entity.User;
import com.feri.fss.service.intf.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Feri
 * @date 2021/12/15 16:03
 * @description:TODO
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao dao;

    @Override
    public PageBean queryPage(int page, int limit) {
        //使用PageHelper插件 完成分页
        PageHelper.startPage(page, limit);
        //获取查询的结果，分页
        PageInfo<User> pageInfo=new PageInfo<>(dao.selectAll());
        //返回结果
        return new PageBean(pageInfo.getTotal(),pageInfo.getList());
    }
}
